package com.fox.imagedb.gui;

import java.awt.Dimension;
import java.io.File;

import javax.swing.JSplitPane;

public class TopPanel extends JSplitPane {

	private static final long serialVersionUID = 1L;

	private ImagePanel imagePanel;

	private DataPanel dataPanel;

	public TopPanel() {
		super(JSplitPane.HORIZONTAL_SPLIT);
		imagePanel = new ImagePanel();
		dataPanel = new DataPanel();
		// FIXME : changer les dimensions
		imagePanel.setPreferredSize(new Dimension(1000, 700));
		imagePanel.setMinimumSize(new Dimension(250, 250));
		setDividerLocation(0.2);
		setLeftComponent(imagePanel);
		setRightComponent(dataPanel);
		setResizeWeight(0.9);
	}

	public ImagePanel getImagePanel() {
		return imagePanel;
	}

	public void setImagePanel(ImagePanel imagePanel) {
		this.imagePanel = imagePanel;
	}

	public DataPanel getDataPanel() {
		return dataPanel;
	}

	public void setDataPanel(DataPanel dataPanel) {
		this.dataPanel = dataPanel;
	}

	public void updateImage(File image) {
		imagePanel.updateImage(image);
		dataPanel.loadData(image);
	}

}
